<include file="Public/header"/>
<div class="row">
    <div class="col-md-12">
        <form class="layui-form" action="" id="payaccess">
            <input type="hidden" name="id" value="<{$pa.id}>">
            <div class="layui-form-item">
                <label class="layui-form-label">金额：</label>
                <div class="layui-input-block">
                    <input type="text" name="pa[money]" lay-verify="required" autocomplete="off"
                           value="<{$pa.money}>" placeholder="固定金额" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">支付URL：</label>
                <div class="layui-input-block">
                    <input type="text" name="pa[url]" lay-verify="required" placeholder="支付链接" value="<{$pa.url}>"
                           style="text-transform:capitalize;" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态：</label>
                <div class="layui-input-block">
                    <input type="radio" name="pa[status]"
                    <if condition="$pa[status] eq 0">checked</if>
                    value="0" title="开启" checked="">
                    <input type="radio" name="pa[status]"
                    <if condition="$pa[status] eq 1">checked</if>
                    value="1" title="关闭">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="submit" lay-filter="add">提交保存</button>
                </div>
            </div>
        </form>
    </div>
</div>
<include file="Public/footer"/>
<script>
    layui.use(['layer', 'form'], function(){
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            $.ajax({
                url:"<{:U('Qrcode/saveCode')}>",
                type:"post",
                data:$('#payaccess').serialize(),
                success:function(res){
                    if(res.status){
                        layer.alert("编辑成功", {icon: 6},function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg("操作失败!", {icon: 5},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>